package com.example.object;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class Coordinate {
	String lat;
	String _long;
	String panelId;
	String panelName;
	long x;
	long y;

	public long getX() {
		return x;
	}

	public void setX(long x) {
		this.x = x;
	}

	public long getY() {
		return y;
	}

	public void setY(long y) {
		this.y = y;
	}

	public String getPanelId() {
		return panelId;
	}

	public void setPanelId(String panelId) {
		this.panelId = panelId;
	}

	public String getPanelName() {
		return panelName;
	}

	public void setPanelName(String panelName) {
		this.panelName = panelName;
	}

	public static ArrayList<Coordinate> getlistArray(String text)
			throws JSONException {
		ArrayList<Coordinate> lstCoor = null;
		JSONArray jArr = new JSONArray(text);
		if (lstCoor == null) {
			lstCoor = new ArrayList<Coordinate>();
		}
		for (int i = 0; i < 2; i++) {
			JSONObject jsonObject = jArr.getJSONObject(i);

			Log.v("TOA DO", jArr.getJSONObject(i).getString("Lat").toString()
					+ ":" + jArr.getJSONObject(i).getString("Long").toString());
			Coordinate coor = new Coordinate();
			coor.setLat(jsonObject.getString("Lat"));
			coor.set_long(jsonObject.getString("Long"));
			lstCoor.add(coor);

		}
		return lstCoor;
	}

	public String getLat() {
		return lat;
	}

	public void setLat(String lat) {
		this.lat = lat;
	}

	public String get_long() {
		return _long;
	}

	public void set_long(String _long) {
		this._long = _long;
	}
}
